<template>
  <div id="app">
    <vue-toastr v-ref:toast></vue-toastr>
    <router-view></router-view>
  </div>
</template>

<script>
import store from 'share/server/vuex/store.js'
import ebus from 'libs/ebus.js'
import {
  doLoadIpcSrcs, 
  doLoadSoftEncs,
  doLoadSuperHdScreens,
  doLoadMtSrcs,
  doLoadEncoders,
  doLoadProxySrcs
} from 'share/server/vuex/actions/streamsrc.js'
import {
  doLoadVidLayouts
} from 'share/server/vuex/actions/multimedia.js'
import {
  doLoadTopoSummary
} from 'share/server/vuex/actions/devmng.js'

export default {
  store,
  vuex: {
    actions: {
      doLoadIpcSrcs,
      doLoadSoftEncs,
      doLoadSuperHdScreens,
      doLoadMtSrcs,
      doLoadEncoders,
      doLoadProxySrcs,
      doLoadVidLayouts,
      doLoadTopoSummary
    }
  },
  methods: {
    initToast () {
      var toast = this.$refs.toast

      toast.defaultTimeout = 3000
      toast.defaultType = "error"
      toast.defaultPosition = "toast-bottom-right"
    },
    loadStreamSrcs (...args) {
      this.doLoadIpcSrcs(...args)
      this.doLoadSoftEncs(...args)
      this.doLoadSuperHdScreens(...args)
      this.doLoadMtSrcs(...args)
      this.doLoadEncoders(...args)
      this.doLoadProxySrcs(...args)      
    }
  },
  ready () {
    this.initToast()
    ebus.on('load-stream-srcs', this.loadStreamSrcs)
    ebus.on('load-mt-srcs', this.doLoadMtSrcs)
    ebus.on('load-vid-layouts', this.doLoadVidLayouts)
    ebus.on('load-topo-summary', this.doLoadTopoSummary)
  }
}
</script>

<style>
</style>